package com.cogwheel.framework.util.input;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

import com.cogwheel.framework.util.CPoint;

public class CMouseListener implements MouseMotionListener, MouseListener{
	public CPoint Position = new CPoint();
	public CMouseState MouseState = CMouseState.NOTHING;
	
	@Override public void mouseMoved(MouseEvent e) { Position.x = e.getX(); Position.y = e.getY(); }
	@Override public void mouseDragged(MouseEvent e) { Position.x = e.getX(); Position.y = e.getY(); }
	@Override
	public void mouseClicked(MouseEvent e) {
		if (e.getButton() == MouseEvent.BUTTON1) MouseState = CMouseState.RIGHT_CLICK;
		if (e.getButton() == MouseEvent.BUTTON3) MouseState = CMouseState.LEFT_CLICK;
	}
	@Override
	public void mousePressed(MouseEvent e) {
		if (e.getButton() == MouseEvent.BUTTON1) MouseState = CMouseState.RIGHT_DOWN;
		if (e.getButton() == MouseEvent.BUTTON3) MouseState = CMouseState.LEFT_DOWN;
	}
	@Override
	public void mouseReleased(MouseEvent e) {
		if (e.getButton() == MouseEvent.BUTTON1) MouseState = CMouseState.RIGHT_UP;
		if (e.getButton() == MouseEvent.BUTTON3) MouseState = CMouseState.LEFT_UP;
	}
	
	@Override public void mouseEntered(MouseEvent e) {}
	@Override public void mouseExited(MouseEvent e) {}

}
